n=1
count=0

while n<10:
    power=1
    while(len(str(n**power))>=power):
        if len(str(n**power))==power:
            count+=1
            print "n=",n,",power=",power
        power+=1
    n+=1
print "count=",count
